import { JOB_TITLE_SELECT_LIST } from '@/pages/supplier/constants/common'
import { list2Obj } from '@/pages/supplier/utils';
// 待考察供应商列表
const FORM_ITEM_LIST = [
  {
    prop: 'supplierCode',
    label: '供应商代码',
    type: 'input'
  },
  {
    prop: 'supplierName',
    label: '供应商名称',
    type: 'input'
  },
  {
    prop: 'personPost',
    label: '职务',
    type: 'select',
    clearable: true,
    options: JOB_TITLE_SELECT_LIST,
  },
  {
    prop: 'serviceArea',
    label: '服务区域',
    type: 'input'
  },
  {
    prop: 'managementScope',
    label: '管理范围',
    type: 'input'
  },
]
// 初始化查询条件
const initFormItem = (addressList) => {
  return [
    {
      prop: 'supplierCode',
      label: '供应商代码',
      type: 'input'
    },
    {
      prop: 'supplierName',
      label: '供应商名称',
      type: 'input'
    },
    {
      prop: 'personPost',
      label: '角色',
      type: 'select',
      clearable: true,
      options: JOB_TITLE_SELECT_LIST,
    },
    {
      prop: 'serviceArea',
      label: '服务区域',
      type: 'select',
      options: addressList
    },
    {
      prop: 'managementScope',
      label: '管理范围',
      type: 'input'
    },
    {
      prop: 'personName',
      label: '姓名',
      type: 'input'
    },
    {
      prop: 'contactPhone',
      label: '联系电话',
      type: 'input'
    },
    {
      prop: 'directSuperior',
      label: '直属上级',
      type: 'input'
    },
  ]
}
const TABLE_COLUMNS = [
  {
    title: '序号',
    key: 'index',
    width: 50
  },
  {
    title: '供应商代码',
    key: 'supplierCode'
  },
  {
    title: '供应商名称',
    key: 'supplierName',
  },
  /* {
    title: '供应商分类',
    key: 'supplierClassify',
    formatter: (row, columns, cellValue) => {
      return list2Obj(SUPPLIER_CATEGORY_SELECT_LIST)[cellValue]
    }
  }, */
  {
    title: '姓名',
    key: 'personName'
  },
  {
    title: '性别',
    key: 'personSex',
    formatter: (row, columns, cellValue) => {
      return { 1: '男', 2: '女' }[cellValue]
    }
  },
  {
    title: '身份证号',
    key: 'idCard'
  },
  {
    title: '职务',
    key: 'personPost',
  },
  {
    title: '角色',
    key: 'personRole',
    formatter: (row, columns, cellValue) => {
      return list2Obj(JOB_TITLE_SELECT_LIST)[cellValue] || cellValue
    }
  },
  {
    title: '直属上级',
    key: 'directSuperior'
  },
  {
    title: '管理范围',
    key: 'managementScope'
  },
  {
    title: '服务区域',
    key: 'serviceArea'
  },
  {
    title: '联系电话',
    key: 'contactPhone'
  },
  {
    title: '微信/QQ',
    key: 'wxQq'
  },
  {
    title: 'E-mail',
    key: 'email'
  },
]
export {
  FORM_ITEM_LIST,
  TABLE_COLUMNS,
  initFormItem
}
